package com.university.mentalhealthplatform.studentV3.ai.message;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AiMessageRepository extends JpaRepository<AiMessageImpl, String> {

    @Query("SELECT a FROM AiMessageImpl a WHERE a.session.id = :sessionId ORDER BY a.createdTime DESC")
    List<AiMessageImpl> findBySessionId(@Param("sessionId") String sessionId);

    void deleteBySessionId(String sessionId);
}